package com.study.opensource.spring.profile;

import com.study.opensource.spring.profile.service.PrintService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.AbstractEnvironment;

/**
 * @author 许棒棒
 * @className com.study.study.opensource.spring.profile.SpringProfileApplication
 * @description TODO 类描述
 * @date 2021/04/17 23:09:02
 */
@ComponentScan(basePackageClasses = PrintService.class)
@Configuration
public class SpringProfileApplication {


    static {
        System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME,"jdk8");
        System.setProperty(AbstractEnvironment.DEFAULT_PROFILES_PROPERTY_NAME,"jdk7");

    }
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(SpringProfileApplication.class);
        context.refresh();
        PrintService bean = context.getBean(PrintService.class);
        bean.print("111","222");
    }
}
